<?php
/**
 * Introduction: 仓库表  stock_shops
 */

namespace Common\Model;


use Think\Model;

class StockShopsModel extends Model
{
    //定义数据库连接信息
    protected $connection;

    //定义表名
    protected $tableName = 'stock_shops';

    /**
     * 初始化
     */
    public function _initialize()
    {

        $this->connection = C('Databaese');

    }

    /**
     * 根据仓库id获取仓库信息
     * @param array $idArr
     * @return array
     */
    public function getInfoById($id)
    {
        $fields = [
            'st.id',
            'st.show_title',
            'st.country_en',
            'st.logisticsId',
            'lc.free',
            'lc.default_price'
        ];
        $res = $this->alias('st')->join("haiou_logistics_temp_con as lc on st.logisticsId=lc.temp_id")->where("st.id=$id")->field($fields)->find();

        return $res;
    }

}